import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
// 解决vue-router重复点击导航栏报错的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const routes = [
  {
    path: '/',
    name: 'Home',
    meta: {
      title: '首页'
    },
    component: () => import('../views/Home.vue')
  },
  {
    path: '/SpeciesObservation',
    name: 'SpeciesObservation',
    meta: {
      title: '物种观测'
    },
    component: () => import('../views/SpeciesObservation.vue')
  },
  {
    path: '/BiologicalObservation',
    name: 'BiologicalObservation',
    meta: {
      title: '生物观测'
    },
    component: () => import('../views/BiologicalObservation.vue')
  },
  {
    path: '/PermanentPlot',
    name: 'PermanentPlot',
    meta: {
      title: '固定样地'
    },
    component: () => import('../views/PermanentPlot.vue')
  },
  {
    path: '/ExperienceRoad',
    name: 'ExperienceRoad',
    meta: {
      title: '体验之路'
    },
    component: () => import('../views/ExperienceRoad.vue')
  },
  {
    path: '/MultipleIndicators',
    name: 'MultipleIndicators',
    meta: {
      title: '生多指标'
    },
    component: () => import('../views/MultipleIndicators.vue')
  },
  {
    path: '/HabitatObservation',
    name: 'HabitatObservation',
    meta: {
      title: '生境观测'
    },
    component: () => import('../views/HabitatObservation.vue')
  },
  {
    path: '/SpeciesAccount',
    name: 'SpeciesAccount',
    meta: {
      title: '物种汇总'
    },
    component: () => import('../views/SpeciesAccount.vue')
  },
  {
    path: '/SpeciesStatisticsAuto',
    name: 'SpeciesStatisticsAuto',
    meta: {
      title: '物种汇总'
    },
    component: () => import('../views/SpeciesStatisticsAuto.vue')
  },
  {
    path: '/ScienceEducation',
    name: 'ScienceEducation',
    meta: {
      title: '科普教育'
    },
    component: () => import('../views/ScienceEducation.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router 